<HTML><HEAD><TITLE>disasm(+PredSpec, ?WAMCode)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(asm)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>disasm(+PredSpec, ?WAMCode)</H1>
Disassemble an existing predicate PredSpec in the current module to its WAM
abstract machine representation WAMCode.


<DL>
<DT><EM>+PredSpec</EM></DT>
<DD>Atom/Integer.
</DD>
<DT><EM>?WAMCode</EM></DT>
<DD>Variable or a list of WAM instructions in the right format.
</DD>
</DL>
<H2>Description</H2>
   Unifies WAMCode with the WAM instructions representing the abstract
   machine code for the predicate specified by PredSpec (in Name/Arity
   form). The WAM code is in the form of a list, with each element
   representing one WAM instruction. The format of the WAMCode is the same
   as that used by asm/2,3 and pasm/4 to assemble a predicate. Thus, the
   WAM code generated by disasm/2,3 can be used to load the predicate into
   ECLiPSe without having to compile the source Prolog form. 

<P>
   The library asm must be loaded to use diasm/2.

<P>
   Currently asm/2 cannot disassemble dynamic predicates.

<P>

<H3>Fail Conditions</H3>
   Fails if WAMCode is initially instantiated and does not unify with the WAM code generated by asm/1 for the predicate, or if PredSpec is dynamic.
<H3>Resatisfiable</H3>
   No.
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>PredSpec is not in correct form.
<DT><EM>(60) referring to an undefined procedure </EM>
<DD>PredSpec does not exist in current module.
</DL>
<H2>Examples</H2>
<PRE>
   for fruit/1 defined by:

      fruit(orange).

   ?- disasm(fruit / 1, W).
   W = [get_atom(a(1), orange), retd, code_end]



</PRE>
<H2>See Also</H2>
<A HREF="../../lib/asm/disasm-3.html">disasm / 3</A>, <A HREF="../../lib/asm/asm-2.html">asm / 2</A>, <A HREF="../../lib/asm/asm-3.html">asm / 3</A>, <A HREF="../../lib/asm/pasm-4.html">pasm / 4</A>, <A HREF="../../lib/asm/wam-1.html">wam / 1</A>
</BODY></HTML>
